package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
import com.ruoyi.system.api.form.LoginBody;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;

@FeignClient(contextId = "remoteLoginService", name = ServiceNameConstants.AUTH_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLoginService {
    @PostMapping("login")
    R<?> login(@RequestBody LoginBody form);

    @DeleteMapping("logout")
    R<?> logout(HttpServletRequest request);

    @PostMapping("refresh")
    R<?> refresh(HttpServletRequest request);

    @PostMapping("register")
    R<?> register(@RequestBody LoginBody registerBody);

}
